package cn.xorange.commons.utils.configuration;

import cn.xorange.commons.utils.cache.entity.CacheEntity;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.HashMap;


/**
 * 缓存超期清理
 *
 * @author yangjian
 */
@Configuration
@ConditionalOnMissingBean(name = "redisConfig")
public class CacheConfig {

    /** 不用redis的情况下，建立全局缓存 */
    @Bean
    public HashMap<String, HashMap<String, CacheEntity>> cache(){
        return new HashMap<>();
    }

    @Value("${mickey.cacheClearKeys:#{null}}")
    public String cacheClearKeys;

}
